﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Infrastructure
{
    [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
    public class EntityClassNotNullableAttribute : Attribute
    {
        private string[] fields = null;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fields">索引字段列表</param>
        /// <param name="isUnique">是否唯一索引</param>
        public EntityClassNotNullableAttribute(string[] fields)
            : base()
        {
            if (fields == null || fields.Length == 0)
            {
                throw new Exception("Fields illegal");
            }

            this.fields = fields;
        } 

        /// <summary>
        /// 索引字段列表
        /// </summary>
        public string[] Fields
        {
            get { return fields; }
        }
    }
}
